home *** CD-ROM | disk | FTP | other *** search
/ Chaos CD Blue / Chaos_CD_Blue__[1999].iso / contrib / security / Cryptography_FAQ_(08_10_Technical_Miscellany) < prev    next >
Internet Message Format  |  1999-11-21  |  20KB

  1. Path: senator-bedfellow.mit.edu!faqserv
  2. From: crypt-comments@math.ncsu.edu
  3. Newsgroups: sci.crypt,talk.politics.crypto,sci.answers,news.answers,talk.answers
  4. Subject: Cryptography FAQ (08/10: Technical Miscellany)
  5. Supersedes: <cryptography-faq/part08_939635163@rtfm.mit.edu>
  6. Followup-To: poster
  7. Date: 1 Nov 1999 11:28:51 GMT
  8. Organization: The Crypt Cabal
  9. Lines: 381
  10. Approved: news-answers-request@MIT.Edu
  11. Expires: 6 Dec 1999 11:27:53 GMT
  12. Message-ID: <cryptography-faq/part08_941455673@rtfm.mit.edu>
  13. References: <cryptography-faq/part01_941455673@rtfm.mit.edu>
  14. Reply-To: crypt-comments@math.ncsu.edu
  15. NNTP-Posting-Host: penguin-lust.mit.edu
  16. X-Last-Updated: 1994/07/05
  17. Originator: faqserv@penguin-lust.MIT.EDU
  18. Xref: senator-bedfellow.mit.edu sci.crypt:112662 talk.politics.crypto:38798 sci.answers:10789 news.answers:170061 talk.answers:4012
  19.  
  20. Archive-name: cryptography-faq/part08
  21. Last-modified: 94/01/25
  22.  
  23. This is the eighth of ten parts of the sci.crypt FAQ. The parts are
  24. mostly independent, but you should read the first part before the rest.
  25. We don't have the time to send out missing parts by mail, so don't ask.
  26. Notes such as ``[KAH67]'' refer to the reference list in the last part.
  27.  
  28. The sections of this FAQ are available via anonymous FTP to rtfm.mit.edu 
  29. as /pub/usenet/news.answers/cryptography-faq/part[xx]. The Cryptography 
  30. FAQ is posted to the newsgroups sci.crypt, talk.politics.crypto, 
  31. sci.answers, and news.answers every 21 days.
  32.  
  33.  
  34.  
  35. Contents
  36.  
  37. 8.1. How do I recover from lost passwords in WordPerfect?
  38. 8.2. How do I break a Vigenere (repeated-key) cipher?
  39. 8.3. How do I send encrypted mail under UNIX? [PGP, RIPEM, PEM, ...]
  40. 8.4. Is the UNIX crypt command secure?
  41. 8.5. How do I use compression with encryption?
  42. 8.6. Is there an unbreakable cipher?
  43. 8.7. What does ``random'' mean in cryptography?
  44. 8.8. What is the unicity point (a.k.a. unicity distance)?
  45. 8.9. What is key management and why is it important?
  46. 8.10. Can I use pseudo-random or chaotic numbers as a key stream?
  47. 8.11. What is the correct frequency list for English letters?
  48. 8.12. What is the Enigma?
  49. 8.13. How do I shuffle cards?
  50. 8.14. Can I foil S/W pirates by encrypting my CD-ROM?
  51. 8.15. Can you do automatic cryptanalysis of simple ciphers?
  52. 8.16. What is the coding system used by VCR+?
  53.  
  54.  
  55. 8.1. How do I recover from lost passwords in WordPerfect?
  56.  
  57.   WordPerfect encryption has been shown to be very easy to break.
  58.   The method uses XOR with two repeating key streams: a typed password
  59.   and a byte-wide counter initialized to 1+<the password length>. Full
  60.   descriptions are given in Bennett [BEN87] and Bergen and Caelli
  61.   [BER91].
  62.  
  63.   Chris Galas writes: ``Someone awhile back was looking for a way to
  64.   decrypt WordPerfect document files and I think I have a solution. 
  65.   There is a software company named: Accessdata (87 East 600 South,
  66.   Orem, UT 84058), 1-800-658-5199 that has a software package that will
  67.   decrypt any WordPerfect, Lotus 1-2-3, Quatro-Pro, MS Excel and Paradox
  68.   files. The cost of the package is $185. Steep prices, but if you
  69.   think your pw key is less than 10 characters, (or 10 char) give them a
  70.   call and ask for the free demo disk. The demo disk will decrypt files
  71.   that have a 10 char or less pw key.'' Bruce Schneier says the phone
  72.   number for AccessData is 801-224-6970.
  73.  
  74. 8.2. How do I break a Vigenere (repeated-key) cipher?
  75.  
  76.   A repeated-key cipher, where the ciphertext is something like the
  77.   plaintext xor KEYKEYKEYKEY (and so on), is called a Vigenere cipher.
  78.   If the key is not too long and the plaintext is in English, do the
  79.   following: 
  80.  
  81.   1. Discover the length of the key by counting coincidences.
  82.   (See Gaines [GAI44], Sinkov [SIN66].) Trying each displacement of
  83.   the ciphertext against itself, count those bytes which are equal. 
  84.   If the two ciphertext portions have used the same key, something
  85.   over 6% of the bytes will be equal. If they have used different
  86.   keys, then less than 0.4% will be equal (assuming random 8-bit bytes
  87.   of key covering normal ASCII text). The smallest displacement which
  88.   indicates an equal key is the length of the repeated key.
  89.  
  90.   2. Shift the text by that length and XOR it with itself. This
  91.   removes the key and leaves you with text XORed with itself. Since
  92.   English has about 1 bit of real information per byte, 2 streams of
  93.   text XORed together has 2 bits of info per 8-bit byte, providing
  94.   plenty of redundancy for choosing a unique decryption. (And in fact
  95.   one stream of text XORed with itself has just 1 bit per byte.)
  96.  
  97.   If the key is short, it might be even easier to treat this as a
  98.   standard polyalphabetic substitution. All the old cryptanalysis
  99.   texts show how to break those. It's possible with those methods, in
  100.   the hands of an expert, if there's only ten times as much text as key.
  101.   See, for example, Gaines [GAI44], Sinkov [SIN66].
  102.  
  103. 8.3. How do I send encrypted mail under UNIX? [PGP, RIPEM, PEM, ...]
  104.  
  105.   Here's one popular method, using the des command:
  106.  
  107.     cat file | compress | des private_key | uuencode | mail
  108.  
  109.   Meanwhile, there is a de jure Internet standard in the works called
  110.   PEM (Privacy Enhanced Mail). It is described in RFCs 1421 through
  111.   1424. To join the PEM mailing list, contact pem-dev-request@tis.com.
  112.   There is a beta version of PEM being tested at the time of this
  113.   writing.
  114.  
  115.   There are also two programs available in the public domain for encrypting
  116.   mail: PGP and RIPEM. Both are available by FTP. Each has its own
  117.   newsgroup: alt.security.pgp and alt.security.ripem. Each has its own FAQ
  118.   as well.
  119.  
  120.   PGP is most commonly used outside the USA since it uses the RSA algorithm
  121.   without a license and RSA's patent is valid only (or at least primarily)
  122.   in the USA.
  123.  
  124.   RIPEM is most commonly used inside the USA since it uses the RSAREF which
  125.   is freely available within the USA but not available for shipment outside
  126.   the USA.
  127.  
  128.   Since both programs use a secret key algorithm for encrypting the body of
  129.   the message (PGP used IDEA; RIPEM uses DES) and RSA for encrypting the
  130.   message key, they should be able to interoperate freely. Although there
  131.   have been repeated calls for each to understand the other's formats and
  132.   algorithm choices, no interoperation is available at this time (as far as
  133.   we know).
  134.  
  135. 8.4. Is the UNIX crypt command secure?
  136.  
  137.   No. See [REE84]. There is a program available called cbw (crypt
  138.   breaker's workbench) which can be used to do ciphertext-only attacks
  139.   on files encrypted with crypt. One source for CBW is [FTPCB].
  140.  
  141. 8.5. How do I use compression with encryption?
  142.  
  143.   A number of people have proposed doing perfect compression followed by
  144.   some simple encryption method (e.g., XOR with a repeated key).  This
  145.   would work, if you could do perfect compression.  Unfortunately, you can
  146.   only compress perfectly if you know the exact distribution of possible
  147.   inputs, and that is almost certainly not possible.
  148.  
  149.   Compression aids encryption by reducing the redundancy of the plaintext.
  150.   This increases the amount of ciphertext you can send encrypted under a
  151.   given number of key bits.  (See "unicity distance")
  152.  
  153.   Nearly all practical compression schemes, unless they have been designed
  154.   with cryptography in mind, produce output that actually starts off with
  155.   high redundancy. For example, the output of UNIX compress begins with a
  156.   well-known three-byte ``magic number''.  This produces a field of "known
  157.   plaintext" which can be used for some forms of cryptanalytic attack.
  158.   Compression is generally of value, however, because it removes other
  159.   known plaintext in the middle of the file being encrypted.  In general,
  160.   the lower the redundancy of the plaintext being fed an encryption
  161.   algorithm, the more difficult the cryptanalysis of that algorithm.
  162.  
  163.   In addition, compression shortens the input file, shortening the output
  164.   file and reducing the amount of CPU required to do the encryption
  165.   algorithm, so even if there were no enhancement of security, compression
  166.   before encryption would be worthwhile.
  167.  
  168.   Compression after encryption is silly.  If an encryption algorithm is
  169.   good, it will produce output which is statistically indistinguishable
  170.   from random numbers and no compression algorithm will successfully
  171.   compress random numbers.  On the other hand, if a compression algorithm
  172.   succeeds in finding a pattern to compress out of an encryption's output,
  173.   then a flaw in that algorithm has been found.
  174.  
  175. 8.6. Is there an unbreakable cipher?
  176.  
  177.   Yes. The one-time pad is unbreakable; see part 4. Unfortunately the
  178.   one-time pad requires secure distribution of as much key material as
  179.   plaintext.
  180.  
  181.   Of course, a cryptosystem need not be utterly unbreakable to be
  182.   useful. Rather, it needs to be strong enough to resist attacks by
  183.   likely enemies for whatever length of time the data it protects is
  184.   expected to remain valid.
  185.  
  186. 8.7. What does ``random'' mean in cryptography?
  187.  
  188.   Cryptographic applications demand much more out of a pseudorandom
  189.   number generator than most applications. For a source of bits to be
  190.   cryptographically random, it must be computationally impossible to
  191.   predict what the Nth random bit will be given complete knowledge of
  192.   the algorithm or hardware generating the stream and the sequence of
  193.   0th through N-1st bits, for all N up to the lifetime of the source.
  194.  
  195.   A software generator (also known as pseudo-random) has the function
  196.   of expanding a truly random seed to a longer string of apparently
  197.   random bits. This seed must be large enough not to be guessed by
  198.   the opponent. Ideally, it should also be truly random (perhaps
  199.   generated by a hardware random number source).
  200.  
  201.   Those who have Sparcstation 1 workstations could, for example,
  202.   generate random numbers using the audio input device as a source of
  203.   entropy, by not connecting anything to it. For example,
  204.  
  205.         cat /dev/audio | compress - >foo
  206.  
  207.   gives a file of high entropy (not random but with much randomness in
  208.   it). One can then encrypt that file using part of itself as a key,
  209.   for example, to convert that seed entropy into a pseudo-random
  210.   string.
  211.  
  212.   When looking for hardware devices to provide this entropy, it is
  213.   important really to measure the entropy rather than just assume that
  214.   because it looks complicated to a human, it must be "random". For
  215.   example, disk operation completion times sound like they might be
  216.   unpredictable (to many people) but a spinning disk is much like a
  217.   clock and its output completion times are relatively low in entropy.
  218.  
  219. 8.8. What is the unicity point (a.k.a. unicity distance)?
  220.  
  221.   See [SHA49]. The unicity distance is an approximation to that amount
  222.   of ciphertext such that the sum of the real information (entropy) in
  223.   the corresponding source text and encryption key equals the number
  224.   of ciphertext bits used. Ciphertexts significantly longer than this
  225.   can be shown probably to have a unique decipherment. This is used to
  226.   back up a claim of the validity of a ciphertext-only cryptanalysis. 
  227.   Ciphertexts significantly shorter than this are likely to have
  228.   multiple, equally valid decryptions and therefore to gain security
  229.   from the opponent's difficulty choosing the correct one.
  230.  
  231.   Unicity distance, like all statistical or information-theoretic
  232.   measures, does not make deterministic predictions but rather gives
  233.   probabilistic results: namely, the minimum amount of ciphertext
  234.   for which it is likely that there is only a single intelligible
  235.   plaintext corresponding to the ciphertext, when all possible keys
  236.   are tried for the decryption. Working cryptologists don't normally
  237.   deal with unicity distance as such. Instead they directly determine
  238.   the likelihood of events of interest.
  239.  
  240.   Let the unicity distance of a cipher be D characters. If fewer than
  241.   D ciphertext characters have been intercepted, then there is not
  242.   enough information to distinguish the real key from a set of
  243.   possible keys. DES has a unicity distance of 17.5 characters,
  244.   which is less than 3 ciphertext blocks (each block corresponds to
  245.   8 ASCII characters). This may seem alarmingly low at first, but
  246.   the unicity distance gives no indication of the computational work
  247.   required to find the key after approximately D characters have been
  248.   intercepted.
  249.  
  250.   In fact, actual cryptanalysis seldom proceeds along the lines used
  251.   in discussing unicity distance. (Like other measures such as key
  252.   size, unicity distance is something that guarantees insecurity if
  253.   it's too small, but doesn't guarantee security if it's high.) Few
  254.   practical cryptosystems are absolutely impervious to analysis; all
  255.   manner of characteristics might serve as entering ``wedges'' to crack
  256.   some cipher messages. However, similar information-theoretic
  257.   considerations are occasionally useful, for example, to determine a
  258.   recommended key change interval for a particular cryptosystem.
  259.   Cryptanalysts also employ a variety of statistical and
  260.   information-theoretic tests to help guide the analysis in the most
  261.   promising directions.
  262.  
  263.   Unfortunately, most literature on the application of information
  264.   statistics to cryptanalysis remains classified, even the seminal
  265.   1940 work of Alan Turing (see [KOZ84]). For some insight into the
  266.   possibilities, see [KUL68] and [GOO83].
  267.  
  268. 8.9. What is key management and why is it important?
  269.  
  270.   One of the fundamental axioms of cryptography is that the enemy is in
  271.   full possession of the details of the general cryptographic system,
  272.   and lacks only the specific key data employed in the encryption. (Of
  273.   course, one would assume that the CIA does not make a habit of telling
  274.   Mossad about its cryptosystems, but Mossad probably finds out anyway.)
  275.   Repeated use of a finite amount of key provides redundancy that can
  276.   eventually facilitate cryptanalytic progress. Thus, especially in
  277.   modern communication systems where vast amounts of information are
  278.   transferred, both parties must have not only a sound cryptosystem but
  279.   also enough key material to cover the traffic.
  280.  
  281.   Key management refers to the distribution, authentication, and
  282.   handling of keys.
  283.  
  284.   A publicly accessible example of modern key management technology
  285.   is the STU III secure telephone unit, which for classified use
  286.   employs individual coded ``Crypto Ignition Keys'' and a central Key
  287.   Management Center operated by NSA. There is a hierarchy in that
  288.   certain CIKs are used by authorized cryptographic control
  289.   personnel to validate the issuance of individual traffic keys and
  290.   to perform installation/maintenance functions, such as the
  291.   reporting of lost CIKs.
  292.  
  293.   This should give an inkling of the extent of the key management
  294.   problem. For public-key systems, there are several related issues,
  295.   many having to do with ``whom do you trust?''
  296.  
  297. 8.10. Can I use pseudo-random or chaotic numbers as a key stream?
  298.  
  299.   Chaotic equations and fractals produce an apparent randomness from
  300.   relatively compact generators. Perhaps the simplest example is a
  301.   linear congruential sequence, one of the most popular types of random
  302.   number generators, where there is no obvious dependence between seeds
  303.   and outputs. Unfortunately the graph of any such sequence will, in a
  304.   high enough dimension, show up as a regular lattice. Mathematically
  305.   this lattice corresponds to structure which is notoriously easy for
  306.   cryptanalysts to exploit. More complicated generators have more
  307.   complicated structure, which is why they make interesting pictures---
  308.   but a cryptographically strong sequence will have no computable
  309.   structure at all.
  310.  
  311.   See [KNU81], exercise 3.5-7; [REE77]; and [BOY89].
  312.  
  313. 8.11. What is the correct frequency list for English letters?
  314.  
  315.   There are three answers to this question, each slightly deeper than
  316.   the one before. You can find the first answer in various books:
  317.   namely, a frequency list computed directly from a certain sample of
  318.   English text.
  319.  
  320.   The second answer is that ``the English language'' varies from author
  321.   to author and has changed over time, so there is no definitive list.
  322.   Of course the lists in the books are ``correctly'' computed, but
  323.   they're all different: exactly which list you get depends on which
  324.   sample was taken. Any particular message will have different
  325.   statistics from those of the language as a whole.
  326.  
  327.   The third answer is that yes, no particular message is going to have
  328.   exactly the same characteristics as English in general, but for all
  329.   reasonable statistical uses these slight discrepancies won't matter.
  330.   In fact there's an entire field called ``Bayesian statistics'' (other
  331.   buzzwords are ``maximum entropy methods'' and ``maximum likelihood
  332.   estimation'') which studies questions like ``What's the chance that a
  333.   text with these letter frequencies is in English?'' and comes up with
  334.   reasonably robust answers.
  335.  
  336.   So make your own list from your own samples of English text. It will
  337.   be good enough for practical work, if you use it properly.
  338.  
  339. 8.12. What is the Enigma?
  340.  
  341.   ``For a project in data security we are looking for sources of
  342.   information about the German Enigma code and how it was broken by
  343.   the British during WWII.''
  344.  
  345.   See [WEL82], [DEA85], [KOZ84], [HOD83], [KAH91].
  346.  
  347. 8.13. How do I shuffle cards?
  348.  
  349.   Card shuffling is a special case of the permutation of an array of
  350.   values, using a random or pseudo-random function. All possible output
  351.   permutations of this process should be equally likely. To do this, you
  352.   need a random function (modran(x)) which will produce a uniformly
  353.   distributed random integer in the interval [0..x-1]. Given that
  354.   function, you can shuffle with the following [C] code: (assuming ARRLTH
  355.   is the length of array arr[] and swap() interchanges values at the two
  356.   addresses given)
  357.  
  358.   for ( n = ARRLTH-1; n > 0 ; n-- ) swap( &arr[modran( n+1 )], &arr[n] ) ;
  359.  
  360.   modran(x) can not be achieved exactly with a simple (ranno() % x) since
  361.   ranno()'s interval may not be divisible by x, although in most cases the
  362.   error will be very small. To cover this case, one can take ranno()'s
  363.   modulus mod x, call that number y, and if ranno() returns a value less
  364.   than y, go back and get another ranno() value.
  365.  
  366.   See [KNU81] for further discussion.
  367.  
  368. 8.14. Can I foil S/W pirates by encrypting my CD-ROM?
  369.  
  370.   Someone will frequently express the desire to publish a CD-ROM with
  371.   possibly multiple pieces of software, perhaps with each encrypted
  372.   separately, and will want to use different keys for each user (perhaps
  373.   even good for only a limited period of time) in order to avoid piracy.
  374.  
  375.   As far as we know, this is impossible, since there is nothing in standard
  376.   PC or workstation hardware which uniquely identifies the user at the
  377.   keyboard. If there were such an identification, then the CD-ROM could be
  378.   encrypted with a key based in part on the one sold to the user and in
  379.   part on the unique identifier. However, in this case the CD-ROM is one
  380.   of a kind and that defeats the intended purpose.
  381.  
  382.   If the CD-ROM is to be encrypted once and then mass produced, there must
  383.   be a key (or set of keys) for that encryption produced at some stage in
  384.   the process. That key is useable with any copy of the CD-ROM's data.
  385.   The pirate needs only to isolate that key and sell it along with the
  386.   illegal copy.
  387.  
  388. 8.15. Can you do automatic cryptanalysis of simple ciphers?
  389.  
  390.   Certainly. For commercial products you can try AccessData; see
  391.   question 8.1. We are not aware of any FTP sites for such software,
  392.   but there are many papers on the subject. See [PEL79], [LUC88],
  393.   [CAR86], [CAR87], [KOC87], [KOC88], [KIN92], [KIN93], [SPI93].
  394.  
  395. 8.16. What is the coding system used by VCR+?
  396.  
  397.   One very frequently asked question in sci.crypt is how the VCR+ codes
  398.   work. The codes are used to program a VCR based on numerical input.
  399.   See [SHI92] for an attempt to describe it.
  400.